var newsTable;
//获取项目建议
function getProjectAdviceList(name) {
    if (typeof newsTable !== 'undefined') {
        newsTable.fnPageChange('first');
        return;
    }
    
    var i = 1;
    newsTable = $("#newsList").DataTable({
        "sAjaxSource": _path + "/projectAdvice/queryByPage",
        "fnServerParams": function (aoData) {
            aoData.push(
                { "name": "studyType", "value": $("#studyType").val() },
                { "name": "fromDate", "value": $("#fromDate").val() },
                { "name": "toDate", "value": $("#toDate").val() }
            );
        },
        "sServerMethod": "POST",
        "sAjaxDataProp": "dataList",
        "fnCreatedRow": function () {
            i++;
        },
        "fnPreDrawCallback": function () {
            i = 1;
        },
        "aoColumns": [
            { "sTitle": "序号", "sWidth": "2%",
                "mData": function () {
                    return i;
                }
            },
            { "sTitle": "学习类型", "mData": "studyType", "sWidth": "10%" },
	        { "sTitle": "专家建议", "sWidth": "20%" ,"mData": 
	          	function(data){
	      		var temps = '<a href="' + _path + '/projectAdvice/edit/' + data.id + '" >'+data.expertAdvice+'</a>';
	      		return temps;
	      	}
	      },
            { "sTitle": "创建时间", "mData": "insertTime", "sWidth": "10%" },
            { "sTitle": "操作", "sWidth": "10%",
                "mData": function (data) {
                		var status = '<a href="' + _path + '/projectAdvice/edit/' + data.id + '" class="btn default btn-xs purple"><i class="fa fa-edit" title="编辑"></i></a>';
                        status += '&nbsp;<a href="javascript:inquiry('+data.id+')"  class="btn default btn-xs red"><i class="fa fa-trash-o" title="删除"></i></a>';
                        return status;
                }
            }
        ]
    });
}


function inquiry(id){
	layer.confirm('您确定要删除吗？', {
		  btn: ['确定','取消'] //按钮
		}, function(){
			location.href = _path + "/projectAdvice/del/" + id;
		}, function(){
		
		});
}